The present invention relates generally to automatic camera focusing mechanisms, and more particularly, to automatic focus methods that remove sensitivity to background illumination.
All modern cameras provide some mechanism for automatic focus adjustment. The automatic focus adjustment system typically has several components, including a detector that evaluates the focus quality, an electronic controller, and a motorized lens assembly. The motorized controller implements an algorithm that causes the focal position of the lens to change until the detector determines that the focus quality has been optimized.
In a digital camera, the image detector (e.g., CCD, CMOS sensor) can also be used as the focus quality detector. The advantages of this method include the fact that no extra elements are required and the absence of registration errors between the focus sensor and the image sensor. In order to use the image sensor as a focus detector, the information from thousands to millions of image pixels must be combined to create a single metric of focus quality. The metric generally is related to the contrast in the image, i.e., as contrast increases the lens becomes more in focus, and as the lens becomes more out of focus the contrast decreases. Consequently, this technique is generally known as the contrast method of focus determination.
The spatial variance of the image is a simple statistic that can serve as an effective focus figure of merit. The spatial variance is maximized when the lens is in focus. When the lens is out of focus, the blur operates like a spatial low-pass filter, decreasing the variance. The metric can be further improved by performing a first difference on the image, along one of its axes, before computing the variance. The first difference operation makes the metric less sensitive to gradual large-scale variations in the image, which are not significantly attenuated when the lens is out of focus.
The spatial variance focus metric depends on the scene illumination level, as well as the scene content and lens focus setting. The variation of the metric with illumination intensity can cause the focus control algorithm to fail if the illumination level changes with time, as it does in the case of fluorescent lights. If the focus control algorithm is presented with a focus metric change caused by an illumination variation, it will interpret it as an error in focus position and it will make an erroneous correction to the focal position. For this reason, the ideal focus figure of merit would be insensitive to illumination intensity.
The obvious way to remove the sensitivity of the focus metric to illumination is to normalize it to the mean illumination intensity. In the case of the variance metric, this can be accomplished by dividing the variance by the square of the mean value of the image. Unfortunately, this does not eliminate the illumination sensitivity because it neglects the effects of noise.
Briefly, the present invention comprises, in one embodiment, a method for providing automatic focus adjustment for an image device, comprising the steps of: differentiating an image along some axis to obtain a difference image; computing a variance of the difference image; determining a noise contribution to the variance; subtracting the noise contribution from the variance; using the adjusted noise variance as a factor in making the automatic focus adjustment.
In a further aspect of the present invention, the step is provided of normalizing the variance.
In a further aspect of the present invention, the normalization of the variance is performed on the variance resulting after performing the subtracting the noise contribution step.
In a further aspect of the present invention, the determining the noise contribution step comprises determining the shot noise contribution to the variance; and wherein the subtracting the noise contribution step comprises subtracting the shot noise.
In a further aspect of the present invention, the determining the noise contribution step comprises determining the read noise; and wherein the subtracting the noise contribution step comprises subtracting the read noise.
In a further aspect of the present invention, the determining the noise contribution step comprises determining the read noise; and wherein the subtracting the noise contribution step comprises subtracting the read noise.
In a further aspect of the present invention, the difference image was determined by subtracting an image from an offset version of itself; and wherein the determining the shot noise contribution to the variance step comprises subtracting the shot noise from the image from the shot noise in the offset version of the image.
In a further aspect of the present invention, the determining the shot noise contribution to the variance step comprises determining the contribution to the variance of the shot noise in the two images that are subtracted to make the difference image, and adding the variances together in order to obtain the total contribution of shot noise to the variance of the difference image.
In a further aspect of the present invention, the determining the read noise contribution to the variance step comprises multiplying the read noise determined from a single image collected in the dark by two.
In a further embodiment of the present invention, a system is provided for automatic focus adjustment for an image device, comprising: a processor designed to compute a variance of a difference image, determine a noise contribution to the variance, subtract the noise contribution from the variance, and to generate a control signal; a lens; and a component for automatically adjusting the focus of the lens, using said control signal as a factor.
In a further aspect of the present invention, the processor normalizes the variance.
In a further aspect of the present invention, the processor determines the noise contribution by determining the shot noise contribution to the variance and subtracts the shot noise from the variance.
In a further embodiment of the present invention, a program product is provided for automatic focus adjustment for an image device, comprising computer readable code for performing the method steps of: computing a variance of a difference image; determining a noise contribution to the variance; and subtracting the noise contribution from the variance.